import { ActionTree, GetterTree, MutationTree, Module } from 'vuex'

declare interface testStore {
  test: string
}

const testStoreState: testStore = {
  test: ''
}

const testStoreGetters: GetterTree<testStore, any> = {
  test: state => state.test
}

const testStoreMutations: MutationTree<testStore> = {
  doUpdateTest(state, payload) {
    state.test = payload
  }
}

const testStoreActions: ActionTree<testStore, any> = {
  updateTest({ commit }, payload) {
    commit('doUpdateTest', payload)
  }
}

const testModule: Module<testStore, any> = {
  state: testStoreState,
  getters: testStoreGetters,
  mutations: testStoreMutations,
  actions: testStoreActions,
  namespaced: true
}

export default testModule
